package com.multimedia.scala.sudoku

import scala.collection.mutable.LinkedList
object Sudoku {
  
    def getFieldEmpty(): List[List[Int]] = {
        return List.fill(9, 9)(0)
    }

	def getFieldWrong(): List[List[Int]] = {
		return List(
		    List(0, 0, 0, 0, 0, 0, 0, 6, 2),
		    List(0, 0, 1, 2, 7, 0, 0, 0, 0),
		    List(0, 3, 6, 0, 0, 8, 0, 0, 0),
		    List(4, 0, 8, 0, 0, 0, 0, 0, 5),
		    List(0, 0, 0, 6, 0, 2, 0, 0, 0),
		    List(5, 0, 0, 0, 0, 0, 2, 0, 3),
		    List(0, 0, 0, 5, 0, 0, 3, 8, 0),
		    List(0, 0, 0, 0, 1, 3, 9, 0, 0),
		    List(7, 4, 0, 0, 0, 0, 0, 0, 0)
		)
	}

	def getFieldRight(): List[List[Int]] = {
		return List(
			List(1, 2, 3, 4, 5, 6, 7, 8, 9),
			List(4, 5, 6, 7, 8, 9, 1, 2, 3),
			List(7, 8, 9, 1, 2, 3, 4, 5, 6),
			List(2, 3, 4, 5, 6, 7, 8, 9, 1),
			List(5, 6, 7, 8, 9, 1, 2, 3, 4),
			List(8, 9, 1, 2, 3, 4, 5, 6, 7),
			List(3, 4, 5, 6, 7, 8, 9, 1, 2),
			List(6, 7, 8, 9, 1, 2, 3, 4, 5),
			List(9, 1, 2, 3, 4, 5, 6, 7, 8)
		)
	}

	def main(args : Array[String]) : Unit = {
		printMatrix(Solver.solve(getFieldWrong()))
	    //println(Solver.solve(getFieldEmpty()))
	    //println(Solver.solve(getFieldRight()))
		//println(Field.possibleNumbers(getFieldWrong(), 1, 5))
	    //println(getFieldWrong()(0)(8))
	}
	def printMatrix(matrix: List[List[Int]]) {
	    for (i <- 0 to matrix.length-1) {
	    	for (j <- 0 to matrix(i).length-1) {
	    	    print(matrix(i)(j)+" ")
	    	}
	    	println
	    }
	}
}
